/* 快速幂
    int qmi(int base, int index, int MOD)
    {
        int res = 1;
        while(index){
            //printf("res:%d base:%d index:%d\n", res, base, index);
            if(index & 1) res = (res * base) % MOD;
            base = (base * base)%MOD;
            index >>= 1;
        }
        return res;
    }

* 本题:
    容斥原理 补集
    不发生的情况(只需要与前一种不同即可)
    m * m-1 * m-1 * ... * m-1
*/

#define DEBUG
#pragma GCC optimize("O1,O2,O3,Ofast")
#pragma GCC optimize("no-stack-protector,unroll-loops,fast-math,inline")
#pragma GCC target("avx,avx2,fma")
#pragma GCC target("sse,sse2,sse3,sse4,sse4.1,sse4.2,ssse3")


#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

#define int long long

const int N = 1e6+10, MOD = 100003;
int primes[N], cnt;
bool st[N];

int qmi(int base, int index, int MOD)
{
    int res = 1;
    while(index){
        //printf("res:%d base:%d index:%d\n", res, base, index);
        if(index & 1) res = (res * base) % MOD;
        base = (base * base)%MOD;
        index >>= 1;
    }
    return res;
}

signed main()
{
    #ifdef DEBUG
        freopen("./in.txt", "r", stdin);
    #else
        ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    #endif

    int m, n; cin >> m >> n;
    cout << ((qmi(m, n, MOD) - m * qmi(m-1, n-1, MOD)) % MOD + MOD) % MOD << endl;
    return 0;
}
